<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
  <%
	String path1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+request.getContextPath();
  %> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script type="text/javascript" src="<%=path1 %>/scripts/jquery-1.7.2.js"></script>
<script type="text/javascript" src="<%=path1 %>/scripts/pagekage/utils/widget/json2.js"></script>
<script type="text/javascript" src="<%=path1 %>/scripts/pagekage/utils/widget/jquery-jtemplates.js"></script>
<script type="text/javascript" src="<%=path1 %>/scripts/post.js"></script>

<title>添加新闻</title>
</head>
<script>
function page_Close() {
    if (window.parent != null) {
       window.parent.close();
      }else {
        window.close();
      }
}

$(function(){
    $('#sub').click(function(){  
    	alert(news.value);
         $.ajax({
            type: "POST",
            url: "news/addNews.do",
            data: {news:$("#news").val(),newsTitle:$("#newsTitle").val(),newsContext:$("#newsContext").val()},
            dataType: "json",
             error:function(data){  
               alert("出错了！！");  
             }, 
             success: function(data){
            	 
            	 window.location.href="http://localhost:8080/xinleju/showNews.jsp";
                  
                }
          });
       });
  });
</script>
<body>
 <form name="form1" action="" method="post">
 <table>
 <tr>
  <td>
     新闻标题:<input type="text" id="newsTitle"/>
  </td>
 </tr>
 <tr>
  <td>
      新闻简介:<input type="text" id="news"/>
  </td>
 </tr>
 <tr>
  <td>
      新闻内容:<input type="text" id="newsContext"/>
  </td>
 </tr>
 <tr>
  <td>    
     <input id="sub" type="button" value="添加"/>
     <input type="reset" />
  </td>
 </tr>
  </table>
 </form>
</body>
</html>